package control;



import java.sql.SQLException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.multiaction.MultiActionController;

import com.ibatis.sqlmap.client.SqlMapClient;

import exception.ReceiveException;
import exception.SendMoneyException;

import model.transfer.HappyMoneyService;
import model.transfer.HappyMoneyVO;

public class HappyMoneyController extends MultiActionController {
	private static HappyMoneyController service = new HappyMoneyController();
	private SqlMapClient sqlMapClient;
	private HappyMoneyController(){
		this.sqlMapClient = sqlMapClient;
	}
	
	
	
	private HappyMoneyService happyMoneyService;
public HappyMoneyController(HappyMoneyService happyMoneyService){
	this.happyMoneyService=happyMoneyService;
}

public ModelAndView transfer(HttpServletRequest request , HttpServletResponse response,HappyMoneyVO hvo) throws SQLException{
	String path = "정상처리되었습니다.";
			try {
			
				happyMoneyService.transfer(hvo);
			
				
			} catch (SQLException e) {
				
				e.printStackTrace();
				
			} catch (ReceiveException e) {
				path = e.getMessage();
				e.printStackTrace();
			} catch (SendMoneyException e) {
				path = e.getMessage();
				e.printStackTrace();
			}
	return new ModelAndView("JsonView","path",path);
}
}
